home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-02-08 | 3.4 KB | 63 lines | [TEXT/MSBA] |
- 1 CLS:PRINT"MATRIX OPERATIONS,DETERMINANTS,LAGRANGE INTERPOLATION,COEFFICIENTS":PRINT
- 2 CLEAR:PRINT"MENU:":PRINT" 1=DETERMINANTS":PRINT" 2=INVERSE MATRIX":PRINT" 3=MULTIPLY MATRIX":PRINT" 4=SOLVE LINEA SIMULTANEOUS EQUATIONS":PRINT" 5=INTERPOLATION+COEFFICIENTS"
- 5 DEFDBL A-D,F-G,O-Z:PRINT:PRINT"DEFINE A(I,J)=A(ROW,C0LUMN)":INPUT "SELECT MENU=";E:ON E GOSUB 10,105,200,300,300,400:GOTO 2
- 7 PRINT"TRY AGAIN:":GOTO 2
- 10 INPUT "DETERMINANT Order,N=";N:N=N-1:DIM A(N,N)
- 15 FOR I=0 TO N:FOR J=0 TO N:PRINT"TERM A(";I+1;",";J+1;")=";:INPUT A(I,J):NEXT J:NEXT I
- 35 FOR M=N TO 1 STEP -1:P=A(M,M):IF P=0 THEN 55
- 40 FOR I=0 TO M-1:Q=A(I,M)/P
- 45 FOR J=0 TO M:A(I,J)=A(I,J)-Q*A(M,J):NEXT J:NEXT I:NEXT M
- 50 D=A(0,0):FOR I=1 TO N:D=D*A(I,I):NEXT I:PRINT"DETERMINANT=";D:RETURN
- 55 PRINT"ERROR":RETURN
- 105 INPUT "MATRIX ORDER (N*N),N=";N:N=N-1:DIM A(N,N):PRINT"INPUT MATRIX TERMS:"
- 106 REM N<=11
- 115 FOR I=0 TO N:FOR J=0 TO N:PRINT"A(";I+1;",";J+1;")=";:INPUT A(I,J):NEXT J:NEXT I
- 125 FOR I=0 TO N:A(I,I)=A(I,I)+1:NEXT I
- 130 FOR M=0 TO N:P=A(M,M)-1:IF P=0 THEN 185
- 135 FOR J=0 TO N:A(M,J)=A(M,J)/P:NEXT J
- 140 FOR I=0 TO N:IF I=M THEN 155
- 145 Q=A(I,M)
- 150 FOR J=0 TO N:A(I,J)=A(I,J)-Q*A(M,J):NEXT J
- 155 NEXT I:NEXT M
- 160 FOR I=0 TO N:A(I,I)=A(I,I)-1:NEXT I
- 163 IF E=4 OR E=5 THEN RETURN
- 170 PRINT"INVERSE MATRIX TERMS:":FOR I=0 TO N:FOR J=0 TO N
- 175 PRINT"C(";I+1;",";J+1;")=";A(I,J):NEXT J:NEXT I:INPUT "PRESS RETURN";C$:RETURN
- 185 PRINT"ERROR":RETURN
- 200 PRINT"MATRIX C(N,M)=A(N,L)*B(L,M)"
- 205 INPUT "1st MATRIX,NUMBER OF ROWS,N=";N:INPUT "NUMBER OF COLUMNS,L=";L:INPUT "2nd MATRIX,NUMBER OF COLUMNS,M=";M1
- 206 REM LIMITS L*(M+N)<=170
- 210 N=N-1:L=L-1:M1=M1-1:DIM A(N,L),C(N,M1)
- 215 PRINT"INPUTS:":FOR I=0 TO N:FOR J=0 TO L:PRINT"A(";I+1;",";J+1;")=";:INPUT A(I,J):NEXT J:NEXT I
- 217 IF E=4 OR E=5 THEN FOR I=0 TO L:FOR J=0 TO M1:PRINT"Y(";I+1;")=";:INPUT B:FOR K=0 TO N:C(K,J)=C(K,J)+A(K,I)*B:NEXT K:NEXT J:NEXT I:RETURN
- 220 PRINT:FOR I=0 TO L:FOR J=0 TO M1:PRINT"B(";I+1;",";J+1;")=";:INPUT B
- 225 FOR K=0 TO N:C(K,J)=C(K,J)+A(K,I)*B:NEXT K:NEXT J:NEXT I
- 227 IF E=4 OR E=5 THEN RETURN
- 230 PRINT"RESULTANT PRODUCT MATRIX TERMS:":FOR I=0 TO N:FOR J=0 TO M1:PRINT"C(";I+1;",";J+1;")=";C(I,J):NEXT J:NEXT I:INPUT "END.PRESS RETURN";C$:RETURN
- 300 IF E=5 THEN INPUT "NUMBER OF DATA POINTS=";N:M1=0:N=N-1:L=N:GOTO 307
- 301 REM N<=11
- 302 INPUT "NUMBER OF EQUATIONS=";N:M1=0:N=N-1:L=N::DIM A(N,N),C(N,1),D(N,N)
- 304 PRINT"INPUT EQUATIONS COEFFICIENTS:":FOR I=0 TO N:FOR J=0 TO L:PRINT"A(";I+1;",";J+1;")=";:INPUT A(I,J):D(I,J)=A(I,J)
- 305 NEXT J:NEXT I:GOTO 325
- 307 DIM A(N,N),C(N,N)
- 310 FOR I=0 TO N:PRINT"X(";I+1;")=";:INPUT A:FOR J=0 TO N:IF J=0 AND A=0 THEN A(I,J)=1:GOTO 315
- 312 A(I,J)=A^J
- 315 NEXT J:NEXT I
- 325 GOSUB 125:GOSUB 217
- 327 IF E=4 THEN FOR I=0 TO N:PRINT"X(";I+1;")=";C(I,0):NEXT I:INPUT "PRESS RETURN";C$:GOTO 345
- 328 PRINT"POLYNOMIAL COEFFICIENTS:":FOR I=0 TO N:PRINT C(I,0);"*X^";I:NEXT I
- 330 INPUT "CHECK & INTERPOLATE:X=";X
- 335 F=C(0,0):FOR I=1 TO N:F=F+C(I,0)*X^I::NEXT I
- 340 PRINT"RESULT,Y=";F:F=0:GOTO 330
- 345 FOR I=0 TO N:F=F+C(I,0)*D(0,I):NEXT I
- 350 PRINT"CHECK IF ";F;"=Y(1):":INPUT "PRESS RETURN";C$:RETURN
- 400 INPUT "NUMBER OF POINTS,N=";N:N=N-1:DIM X(N),Y(N),B(N)
- 401 REM N<=60
- 405 FOR I=0 TO N:PRINT"X(";I+1;")=";:INPUT X(I):NEXT I
- 410 FOR I=0 TO N:PRINT"Y(";I+1;")=";:INPUT Y(I):NEXT I
- 415 INPUT "REQUIRED X=";Z
- 420 P=0:FOR K=0 TO N:B(K)=1:FOR J=0 TO N:IF J=K THEN 430
- 425 B(K)=B(K)*(Z-X(J))/(X(K)-X(J))
- 430 NEXT J:P=P+B(K)*Y(K):NEXT K:PRINT"RESULT Y=";P:GOTO 415
- MACINTOSH LISTING
-